#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
using namespace std;
#include<algorithm>
#include<cmath>
#include<string>

int a1[41][41];
void solve1() {
	int n;
	cin >> n;
	a1[1][n / 2 + 1] = 1;
	int tianchong = 2;
	int i = 1; 
	int j = n / 2 + 1;
	while (tianchong <= n * n) {
		if (i == 1 && j != n) {
			a1[n][j + 1] = tianchong++;
			i = n;
			j = j + 1;
			continue;
		}
		if (i != 1 && j == n) {
			a1[i - 1][1] = tianchong++;
			i = i - 1;
			j = 1;
			continue;
		}
		if (i == 1 && j == n) {
			a1[i + 1][n] = tianchong++;
			i = i + 1;
			j = n;
			continue;
		}
		if (i != 1 && j != n) {
			if (a1[i - 1][j + 1] == 0) {
				a1[i - 1][j + 1] = tianchong++;
				i = i - 1;
				j = j + 1;
				continue;
			}
			else {
				a1[i + 1][j] = tianchong++;
				i = i + 1;				
				continue;
			}
		}

	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			cout << a1[i][j] << " ";
		}
		cout << '\n';
	}

	
	return;
}

void solve2() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] >= 'a' && s[i] <= 'z')
			s[i] -= 32;
	}
	cout << s;

	return;
}


void solve3() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		s[i] = (s[i] + n - 97) % 26 + 'a';
	}
	for (char a : s) {
		cout << a;
	}
	
	return;
}

void solve4() {
	int a4_count = 0;
	string s;
	string trp;
	while (cin >> trp) {
		s = s +  trp;
	}
	for (char temp : s) {
		if (temp != ' ' && temp != '\n') {
			a4_count++;
		}
	}
	cout << a4_count;
	return;
}

bool ifprime(int a) {
	if (a == 0 || a == 1)
		return false;
	for (int i = 2; i < a; ++i) {
		if (a % i == 0)
			return false;
	}
	return true;
}

int a5[155];
void solve5() {

	int mini = 100, maxium = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i)
		a5[s[i]]++;

	for (int i = 0; i < s.size(); ++i)
	{
		if (mini > a5[s[i]]) {
			mini = a5[s[i]];
		}
		if (maxium < a5[s[i]]) {
			maxium = a5[s[i]];
		}
	}
	if (ifprime(maxium-mini)) 
		cout << "Lucky Word" << '\n';
	else
		cout << "No Answer" << '\n';

	cout << maxium - mini;
	return;
}

void solve6() {
	int n;
	cin >> n;
	cin.ignore();  // 清除残留的换行符
	string trp;
	string sss="";
	string s1;
	string s2;
	char temp='1';
	for (int k = 1; k <= n; ++k) {
		getline(cin, trp);
		
		temp = (trp[0] == 'a' || trp[0] == 'b' || trp[0] == 'c') ? trp[0] : temp;

		if (temp == 'a') {
			sss = "";
			s1 = "";
			s2 = "";
			int flag = 0;
			for (int i = 0; i < trp.size(); ++i) {
				if (trp[i] == 'a' || trp[i] == 'b' || trp[i] == 'c' || (i == 1 && trp[i] == ' '))
					continue;
				if (trp[i] == ' ') {
					flag = i;
					s1 = sss;
					s2 = "";
					sss += '+';
					continue;
				}
				sss += trp[i];
				s2 += trp[i];
				if (i == trp.size() - 1) {
					
					sss+= "=";

					cout << sss ;
					cout << stoi(s1) + stoi(s2) << '\n';
					int sum = stoi(s1) + stoi(s2);
					sss += to_string(sum);
					cout << sss.size();

				}
			}
			cout << '\n';

		}
		if (temp == 'b') {
			sss = "";
			s1 = "";
			s2 = "";
			int flag = 0;
			for (int i = 0; i < trp.size(); ++i) {
				if (trp[i] == 'a' || trp[i] == 'b' || trp[i] == 'c' || (i == 1 && trp[i] == ' '))
					continue;
				if (trp[i] == ' ') {
					flag = i;
					s1 = sss;
					s2 = "";
					sss += '-';
					continue;
				}
				sss += trp[i];
				s2 += trp[i];
				if (i == trp.size() - 1) {

					sss += "=";

					cout << sss;
					cout << stoi(s1) - stoi(s2) << '\n';
					int sum = stoi(s1) - stoi(s2);
					sss += to_string(sum);
					cout << sss.size();

				}
			}
			cout << '\n';
		}
		if (temp == 'c') {
			sss = "";
			s1 = "";
			s2 = "";
			int flag = 0;
			for (int i = 0; i < trp.size(); ++i) {
				if (trp[i] == 'a' || trp[i] == 'b' || trp[i] == 'c' || (i == 1 && trp[i] == ' '))
					continue;
				if (trp[i] == ' ') {
					flag = i;
					s1 = sss;
					s2 = "";
					sss += '*';
					continue;
				}
				sss += trp[i];
				s2 += trp[i];
				if (i == trp.size() - 1) {

					sss += "=";

					cout << sss;
					cout << stoi(s1) * stoi(s2) << '\n';
					int sum = stoi(s1) * stoi(s2);
					sss += to_string(sum);
					cout << sss.size();

				}
			}
			cout << '\n';
		}
		
	}

	return;
}

void solve7() {

	char a = '1';
	char  b[10];
	int n;
	cin >> n;
	int c;
	int d;
	char output[100];
	for (int i = 1; i <= n; ++i) {
		cin >> b;
		if (b[0] >= 'a' && b[0] <= 'c') {
			a = b[0];
			cin >> c >> d;
		}
		else
		{
			sscanf(b, "%d", &c); // c = 123（遇到 'a' 停止解析）
			cin >> d;
		}
		
		memset(output, 0, sizeof(output));//清空原有的字符串，防止长度判断错误
		if (a == 'a') {
			sprintf(output,"%d+%d=%d", c, d, c + d);
		}
		if (a == 'b') {
			sprintf(output, "%d-%d=%d", c, d, c - d);
		}
		if (a == 'c') {
			sprintf(output, "%d*%d=%d", c, d, c * d);
		}
		cout << output << '\n' << strlen(output) << '\n';
	}

	return;
}


void solve8() {
	string s;
	getline(cin, s);
	int a8count = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == ' ') {
			a8count++;
			continue;
		}
		if (s[i] >= 'a' && s[i] <= 'c') {
			a8count = a8count + (s[i] - 'a' + 1);
			continue;
		}
		if (s[i] >= 'd' && s[i] <= 'f') {
			a8count = a8count + (s[i] - 'd' + 1);
			continue;
		}
		if (s[i] >= 'g' && s[i] <= 'i') {
			a8count = a8count + (s[i] - 'g' + 1);
			continue;
		}
		if (s[i] >= 'j' && s[i] <= 'l') {
			a8count = a8count + (s[i] - 'j' + 1);
			continue;
		}
		if (s[i] >= 'm' && s[i] <= 'o') {
			a8count = a8count + (s[i] - 'm' + 1);
			continue;
		}
		if (s[i] >= 'p' && s[i] <= 's') {
			a8count = a8count + (s[i] - 'p' + 1);
			continue;
		}
		if (s[i] >= 't' && s[i] <= 'v') {
			a8count = a8count + (s[i] - 't' + 1);
			continue;
		}
		if (s[i] >= 'w' && s[i] <= 'z') {
			a8count = a8count + (s[i] - 'w' + 1);
			continue;
		}
	}
	cout << a8count;

	return;
}


void solve9() {
	string s;
	getline(cin, s);
	int count1 = 0;
	int count2 = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == '.') {
			continue;
		}
		if (s[i] == 'b' || s[i + 1] == 'o' || s[i + 2] == 'y') {
			count1++;
			continue;
		}
		if (s[i] == 'g' || s[i + 1] == 'i' || s[i + 2] == 'r' || s[i + 3] == 'l') {
			
			count2++;
			continue;
		}
		
	}
	cout << count1 << '\n' << count2;




	return;
}

void solve10() {
	int boy = 0, girl = 0, n = 0;
	string a;
	cin >> a;
	n = a.length();
	for (int i = 0; i < n - 2; i++)
		boy += (a[i] == 'b' || a[i + 1] == 'o' || a[i + 2] == 'y');
	for (int i = 0; i < n - 3; i++)
		girl += (a[i] == 'g' || a[i + 1] == 'i' || a[i + 2] == 'r' || a[i + 3] == 'l');
	cout << boy << endl << girl;
	
	
	return;
}


void solve11() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int a11count = 0;
	int flag = 0;
	//更好的思路，把VK都变成XX,然后找VV或KK，就变一次，也不用分类很细.
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == 'V' && s[i + 1] == 'K') {
			a11count++;
			++i;
			continue;
		}
		if (s[i] == 'V' && s[i + 1] == 'V' && flag == 0) {
			if ((i + 2 < n && s[i + 2] != 'K') || i + 1 == n - 1) {
				a11count++;
				flag = 1;
				continue;
			}
			
		}
		if (s[i] == 'K' && s[i + 1] == 'K' && flag == 0) {
			a11count++;
			flag = 1;
			
		}
	}
	cout << a11count;


	return;
}

int main() {

	//solve1();
	//solve2();
	//solve3();
	//solve4();
	//solve5();
	//solve6();
	//solve7();
	//solve8();
	//solve9();
	//solve10();
	solve11();


	return 0;
}